package com.zhongpengcheng.blog.exception;

import com.zhongpengcheng.blog.enums.ResultCodeEnum;
import org.springframework.lang.NonNull;

import javax.servlet.ServletException;

import static com.zhongpengcheng.blog.enums.ResultCodeEnum.ERROR;

/**
 * 404异常
 * @author ZhongPengCheng
 * @version 1.0
 * @date 2021-08-21 13:51:00
 */
public class UrlNotFoundException extends ServletException {
    private static final long serialVersionUID = 7570563634762844749L;
    private final ResultCodeEnum resultCode;

    public UrlNotFoundException() {
        this(ERROR);
    }

    public UrlNotFoundException(String message) {
        super(message);
        resultCode = ERROR;
    }

    public UrlNotFoundException(@NonNull ResultCodeEnum resultCode) {
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }

    public ResultCodeEnum getResultCode() {
        return resultCode;
    }
}
